{
    "swagger": "2.0",
    "info": {
        "title": "Board API",
        "description": "HTTP JSON API",
        "version": "1.0.0"
    },
    "host": "localhost:8080",
    "basePath": "/api",
    "schemes": [
        "https"
    ],
    "consumes": [
        "application/json"
    ],
    "produces": [
        "application/json"
    ],
    "paths": {
        "/adverts": {
            "get": {
                "tags": [
                    "Adverts"
                ],
                "responses": {
                    "200": {
                        "description": "Success response",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/AdvertList"
                            }
                        }
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            }
        },
        "/adverts/{advertId}": {
            "get": {
                "tags": [
                    "Adverts"
                ],
                "parameters": [
                    {
                        "name": "advertId",
                        "in": "path",
                        "description": "ID of advert",
                        "required": true,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success response",
                        "schema": {
                            "$ref": "#/definitions/AdvertDetail"
                        }
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            }
        },
        "/adverts/{advertId}/favorite": {
            "post": {
                "tags": [
                    "Adverts"
                ],
                "parameters": [
                    {
                        "name": "advertId",
                        "in": "path",
                        "required": true,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success response"
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Adverts"
                ],
                "parameters": [
                    {
                        "name": "advertId",
                        "in": "path",
                        "required": true,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Success response"
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            }
        },
        "/register": {
            "post": {
                "tags": [
                    "Profile"
                ],
                "parameters": [
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/RegisterRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success response"
                    }
                }
            }
        },
        "/": {
            "get": {
                "tags": [
                    "Info"
                ],
                "responses": {
                    "200": {
                        "description": "API version",
                        "schema": {
                            "properties": {
                                "version": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/user/favorites": {
            "get": {
                "tags": [
                    "Favorites"
                ],
                "responses": {
                    "200": {
                        "description": "Success response",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/AdvertList"
                            }
                        }
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            }
        },
        "/user/favorites/{advertId}": {
            "delete": {
                "tags": [
                    "Favorites"
                ],
                "parameters": [
                    {
                        "name": "advertId",
                        "in": "path",
                        "required": true,
                        "type": "integer"
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Success response"
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            }
        },
        "/user": {
            "get": {
                "tags": [
                    "Profile"
                ],
                "responses": {
                    "200": {
                        "description": "Success response",
                        "schema": {
                            "$ref": "#/definitions/Profile"
                        }
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Profile"
                ],
                "parameters": [
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/ProfileEditRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success response"
                    }
                },
                "security": [
                    {
                        "Bearer": [],
                        "OAuth2": []
                    }
                ]
            }
        }
    },
    "definitions": {
        "ErrorModel": {
            "required": [
                "code",
                "message"
            ],
            "properties": {
                "code": {
                    "type": "integer"
                },
                "message": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "RegisterRequest": {
            "properties": {
                "name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "password": {
                    "type": "string"
                },
                "password_confirmation": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "ProfileEditRequest": {
            "properties": {
                "name": {
                    "type": "string"
                },
                "last_name": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "AdvertDetail": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "user": {
                    "properties": {
                        "name": {
                            "type": "string"
                        },
                        "phone": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "category": {
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "region": {
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "title": {
                    "type": "string"
                },
                "content": {
                    "type": "string"
                },
                "price": {
                    "type": "integer"
                },
                "address": {
                    "type": "string"
                },
                "date": {
                    "properties": {
                        "published": {
                            "type": "date"
                        },
                        "expires": {
                            "type": "date"
                        }
                    },
                    "type": "object"
                },
                "values": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/AdvertValue"
                    }
                },
                "photos": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "type": "object"
        },
        "AdvertValue": {
            "properties": {
                "name": {
                    "type": "string"
                },
                "value": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "AdvertList": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "user": {
                    "properties": {
                        "name": {
                            "type": "string"
                        },
                        "phone": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "category": {
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "region": {
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "title": {
                    "type": "string"
                },
                "price": {
                    "type": "integer"
                },
                "date": {
                    "type": "date"
                },
                "photo": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "Profile": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "email": {
                    "type": "string"
                },
                "phone": {
                    "properties": {
                        "number": {
                            "type": "string"
                        },
                        "verified": {
                            "type": "boolean"
                        }
                    },
                    "type": "object"
                },
                "name": {
                    "properties": {
                        "first": {
                            "type": "string"
                        },
                        "last": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        }
    },
    "securityDefinitions": {
        "OAuth2": {
            "type": "oauth2",
            "flow": "password",
            "tokenUrl": "https://localhost:8080/oauth/token"
        },
        "Bearer": {
            "type": "apiKey",
            "name": "Authorization",
            "in": "header"
        }
    }
}